﻿<?php
/**
 * @version     1.0.0
 * @package     com_geotrails
 * @copyright   Copyright (C) 2011. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 * @author      Verbier Technologies Sarl
 */

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// Add Mootols library
JHtml::_('behavior.mootools');
JHtml::_('behavior.tooltip');

// Add stylesheet & Javascript
$document =& JFactory::getDocument();
$document->addStyleSheet( JURI::base().'components/com_geotrails/assets/css/style.css' );

if ($this->params->get('show_search_form')) {
	$document->addScript(JURI::root()."components/com_geotrails/assets/js/ajax_search.js");
}

if ($this->params->get('show_paginate')) {
	if (!$this->params->get('show_search_form')) {
		$document->addScript(JURI::root()."components/com_geotrails/assets/js/ajax_search.js");
	}
	
	if ($this->paginate < count($this->trails)) {
		$document->addScript(JURI::root()."components/com_geotrails/assets/js/ajax_search_paginate.js");
	}
}
?>
<div id="com_geotrails">
	<div class="rss">
		<a href="<?php echo JRoute::_('index.php?option=com_geotrails&view=geotrails&format=feed&Itemid='.$this->Itemid, false); ?>" >
			<?php echo JHtml::image(JURI::root().'components/com_geotrails/assets/images/icon-rss.jpg', JText::_('COM_GEOTRAILS_VIEW_GEOTRAILS_RSS'), array('align' => 'middle')); ?>
		</a>
	</div>
	<?php if (strlen($this->title)) { ?>
	<h2><?php echo $this->title.' '.$this->activity_text; ?></h2>
	<?php } ?>
	<?php if ($this->params->get('show_search_form') || $this->params->get('show_map')) { ?>
		<?php $pane =& JPane::getInstance('sliders', array('startOffset'=>-1, 'startTransition'=>0, 'allowAllClose' => true)); ?>
		<?php echo $pane->startPane( 'com_geotrails_list_pane' ); ?>	
	<?php } ?>
	<?php if ($this->params->get('show_map')) { ?>
		<?php echo $pane->startPanel( JText::_('COM_GEOTRAILS_VIEW_CARTE'), 'com_geotrails_list_slide1' ); ?>
		<?php echo $this->loadTemplate('map'); ?>
		<?php echo $pane->endPanel(); ?>
	<?php } ?>	
	<?php if ($this->params->get('show_search_form')) { ?>
		<?php echo $pane->startPanel( JText::_('COM_GEOTRAILS_VIEW_FILTER'), 'com_geotrails_list_slide2' ); ?>
		<?php echo $this->loadTemplate('search'); ?>
		<?php echo $pane->endPanel(); ?>
	<?php } ?>
	<?php if ($this->params->get('show_search_form') || $this->params->get('show_map')) { ?>
		<?php echo $pane->endPane(); ?>
	<?php } ?>
	<div id="com_geotrails_loading"></div>
	<div id="com_geotrails_content">
		<?php if (!strlen($this->params->get('view_type'))) { ?>
		<?php echo $this->loadTemplate('default'); ?>
		<?php } else { ?>
		<?php echo $this->loadTemplate($this->params->get('view_type')); ?>
		<?php } ?>
	</div>
	<?php echo $this->loadTemplate('paginate'); ?>
	<input type="hidden" id="com_geotrails_activity_id" value="<?php echo $this->activityId; ?>">
</div>
